[One .NET] update $(PackageTargetFallback) for NuGet packages#5654
Merged
jonathanpeppers merged 1 commit intodotnet:masterfrom Feb 24, 2021
Merged
Conversation
Context: https://github.com/dotnet/designs/blob/38bffe6c03a149c80f1c3b22787f33c794e71c76/accepted/2021/net6.0-tfms/net6.0-tfms.md We don't have a complete implementation for .NET 6 & NuGet yet, so for for things to work *at all* we have `Microsoft.Android.Sdk.NuGet.targets` that contains workarounds that enable: * Given some NuGet package, `Foo.nupkg` * Try `lib/net6.0-android/Foo.dll` * Try `lib/monoandroid10.0/Foo.dll`, other `$(TFV)` etc. We can now test the above scenario with AndroidX NuGet packages: * dotnet/android-libraries#247 * https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json * `<PackageReference Include="Xamarin.AndroidX.AppCompat" Version = "1.2.0.7-net6preview01" />` Unfortunately, consuming `Xamarin.AndroidX.AppCompat` results in our build using `lib/monoandroid90/Xamarin.AndroidX.AppCompat.dll` over the .NET 6 one! I was able to reproduce this failure in the `XASdkTests.DotNetBuild()` test, as any `Release` build will fail during linking when using `MonoAndroid` assemblies without `KnownPackages.AddDotNetCompatPackages()`. To solve the problem, we need to list `net6.0-android30.0` in `$(PackageTargetFallback)`. Now .NET 6 packages are preferred over `MonoAndroid` ones. Lastly I added `MonoAndroid11.0`, because it was missing. Eventually I hope to delete `Microsoft.Android.Sdk.NuGet.targets` completely when the NuGet implementation of TFMs in .NET 6 is complete.
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
radekdoulik
approved these changes
Feb 24, 2021
dellis1972
approved these changes
Feb 24, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: https://github.com/dotnet/designs/blob/38bffe6c03a149c80f1c3b22787f33c794e71c76/accepted/2021/net6.0-tfms/net6.0-tfms.md
We don't have a complete implementation for .NET 6 & NuGet yet, so for
for things to work at all we have
Microsoft.Android.Sdk.NuGet.targetsthat contains workarounds that enable:
Foo.nupkglib/net6.0-android/Foo.dlllib/monoandroid10.0/Foo.dll, other$(TFV)etc.We can now test the above scenario with AndroidX NuGet packages:
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version = "1.2.0.7-net6preview01" />Unfortunately, consuming
Xamarin.AndroidX.AppCompatresults in ourbuild using
lib/monoandroid90/Xamarin.AndroidX.AppCompat.dlloverthe .NET 6 one!
I was able to reproduce this failure in the
XASdkTests.DotNetBuild()test, as any
Releasebuild will fail during linking when usingMonoAndroidassemblies withoutKnownPackages.AddDotNetCompatPackages().To solve the problem, we need to list
net6.0-android30.0in$(PackageTargetFallback). Now .NET 6 packages are preferred overMonoAndroidones. Lastly I addedMonoAndroid11.0, because it wasmissing.
Eventually I hope to delete
Microsoft.Android.Sdk.NuGet.targetscompletely when the NuGet implementation of TFMs in .NET 6 is
complete.